#include<iostream>
using namespace std;
#include<unistd.h>
#include<pthread.h>
void * thread_routine(void* args)
{
    string name = (const char*)(args);
    //第二个死循环
    while (true)
    {
        cout<< "我是新线程..., 名字: " << name << " pid: " << getpid()<<endl;
        sleep(1);
    }
    
}
int main()
{
    pthread_t tid;
    //将"thread-1"传给回调函数thread_routine
    pthread_create(&tid,nullptr,thread_routine,(void*)"thread-1");

    //第一个死循环
    while(true)
    {
        cout<<"我是主线程...，pid："<<getpid()<<endl;
        sleep(1);
    }
    return 0;
}